import java.util.Arrays;
import java.util.Scanner;

public class Test11 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        int n = in.nextInt();
        Integer[] nums = new Integer[n];
        for(int i  = 0 ; i < n ;i++) nums[i]  = in.nextInt();

        Arrays.sort(nums  ,(a, b) ->{
            String ab = a.toString() + b.toString();
            String ba = b.toString() + a.toString();
            return ab.compareTo(ba);
        });

        StringBuilder ret = new StringBuilder();
        for(Integer num:nums) ret.append(num);
        System.out.println(ret.toString());
    }
}
